package com.cat.greedyAlgorithm;

import java.io.*;

/**
 * @author 曲大人的喵
 * @description luogu.com.cn/problem/P3811
 * @create 2025/10/11 18:43
 * @since JDK17
 */

public class Solution76 {
    static int N = ((int) (1e9 + 7)), n, m, MAXN = ((int) (3e6 + 10));
    static int[] inv = new int[MAXN];
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StreamTokenizer in = new StreamTokenizer(br);
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        // 接收输入
        in.nextToken();
        n = ((int) in.nval);
        in.nextToken();
        m = ((int) in.nval);
        inv[0] = 1;
        for (int i = 1; i < n; i++) {
            inv[i] = (int) (m - (long) inv[m % i] * (m / i) % m);
        }
        for (int i = 0; i < n; i++) {
            out.println(inv[i]);
        }
        br.close();
        out.flush();
        out.close();
    }
}
